package com.well.rpc.handler;

import com.well.rpc.config.ClientDataConfig;
import com.well.rpc.job.WellJobHandler;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * <p>
 * 扫描用户注册的定时任务事件
 * </p>
 *
 * @author weedo
 * @since 2022/8/5
 */
public class ClientPostProcessor implements BeanPostProcessor {

     @Override
     public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
         if (bean instanceof WellJobHandler) {
             ClientDataConfig.saveJobHandler(beanName, (WellJobHandler)bean);
         }
        return bean;
    }
}
